package com.qfedu.aunt.commons.observer.impl;

import com.qfedu.aunt.commons.observer.Observer;
import com.qfedu.aunt.commons.observer.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * @author xiaobobo
 * @title: SubjectImpl
 * @projectName cd-2209-springboot-parent
 * @description: 这个类的主要作用就是要调用观察者实现通知
 * @date 2022/10/19  14:55
 */
@Component
public class SubjectImpl implements Subject {

    @Autowired
    private List<Observer> observerList;

    @Override
    public void notifyOperator(String msg) {
      //这里就要实施通知了
        for (Observer observer:observerList) {
             observer.notifyOperator(msg);
        }
    }
}
